﻿var ShowPhoto = {};
ShowPhoto.init = function() {
    var MyMar;
    var speed = 10; //速度，越大越慢
    var spec = 1; //每次滚动的间距, 越大滚动越快
    // var ipath = 'images/'; //图片路径
    var thumbs = $('.thumb_img');
    for (var i = 0; i < thumbs.length; i++) {
        thumbs[i].onclick = function() {
            $('#main_img')[0].src = this.attributes['src'].value;
            $('#currentIndex').html($(this).attr('index'));
        };
    }
    $("#gotop").mouseover(function() {
        MyMar = setInterval(gotop, speed);
    });
    $('#gotop').mouseout(function() {
        clearInterval(MyMar);
    });
    $('#gobottom').mouseover(function() {
        MyMar = setInterval(gobottom, speed);
    });
    $("#gobottom").mouseout(function() {
        clearInterval(MyMar);
    });

    function gotop() { $('#easte-small-img-area')[0].scrollTop -= spec; }

    function gobottom() { $('#easte-small-img-area')[0].scrollTop += spec; }
};
